<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>tab.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_ui_tab.js.html">tab.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2008 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview A tab control, designed to be used in {@link goog.ui.TabBar}s.
<a name="line17"></a> *
<a name="line18"></a> * @author attila@google.com (Attila Bodis)
<a name="line19"></a> * @see ../demos/tabbar.html
<a name="line20"></a> */
<a name="line21"></a>
<a name="line22"></a>goog.provide(&#39;goog.ui.Tab&#39;);
<a name="line23"></a>
<a name="line24"></a>goog.require(&#39;goog.ui.Component.State&#39;);
<a name="line25"></a>goog.require(&#39;goog.ui.Control&#39;);
<a name="line26"></a>goog.require(&#39;goog.ui.ControlContent&#39;);
<a name="line27"></a>goog.require(&#39;goog.ui.TabRenderer&#39;);
<a name="line28"></a>goog.require(&#39;goog.ui.registry&#39;);
<a name="line29"></a>
<a name="line30"></a>
<a name="line31"></a>
<a name="line32"></a>/**
<a name="line33"></a> * Tab control, designed to be hosted in a {@link goog.ui.TabBar}.  The tab&#39;s
<a name="line34"></a> * DOM may be different based on the configuration of the containing tab bar,
<a name="line35"></a> * so tabs should only be rendered or decorated as children of a tab bar.
<a name="line36"></a> * @param {goog.ui.ControlContent} content Text caption or DOM structure to
<a name="line37"></a> *     display as the tab&#39;s caption (if any).
<a name="line38"></a> * @param {goog.ui.TabRenderer=} opt_renderer Optional renderer used to render
<a name="line39"></a> *     or decorate the tab.
<a name="line40"></a> * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM hepler, used for
<a name="line41"></a> *     document interaction.
<a name="line42"></a> * @constructor
<a name="line43"></a> * @extends {goog.ui.Control}
<a name="line44"></a> */
<a name="line45"></a>goog.ui.Tab = function(content, opt_renderer, opt_domHelper) {
<a name="line46"></a>  goog.ui.Control.call(this, content,
<a name="line47"></a>      opt_renderer || goog.ui.TabRenderer.getInstance(), opt_domHelper);
<a name="line48"></a>
<a name="line49"></a>  // Tabs support the SELECTED state.
<a name="line50"></a>  this.setSupportedState(goog.ui.Component.State.SELECTED, true);
<a name="line51"></a>
<a name="line52"></a>  // Tabs must dispatch state transition events for the DISABLED and SELECTED
<a name="line53"></a>  // states in order for the tab bar to function properly.
<a name="line54"></a>  this.setDispatchTransitionEvents(
<a name="line55"></a>      goog.ui.Component.State.DISABLED | goog.ui.Component.State.SELECTED,
<a name="line56"></a>      true);
<a name="line57"></a>};
<a name="line58"></a>goog.inherits(goog.ui.Tab, goog.ui.Control);
<a name="line59"></a>
<a name="line60"></a>
<a name="line61"></a>/**
<a name="line62"></a> * Tooltip text for the tab, displayed on hover (if any).
<a name="line63"></a> * @type {string|undefined}
<a name="line64"></a> * @private
<a name="line65"></a> */
<a name="line66"></a>goog.ui.Tab.prototype.tooltip_;
<a name="line67"></a>
<a name="line68"></a>
<a name="line69"></a>/**
<a name="line70"></a> * @return {string|undefined} Tab tooltip text (if any).
<a name="line71"></a> */
<a name="line72"></a>goog.ui.Tab.prototype.getTooltip = function() {
<a name="line73"></a>  return this.tooltip_;
<a name="line74"></a>};
<a name="line75"></a>
<a name="line76"></a>
<a name="line77"></a>/**
<a name="line78"></a> * Sets the tab tooltip text.  If the tab has already been rendered, updates
<a name="line79"></a> * its tooltip.
<a name="line80"></a> * @param {string} tooltip New tooltip text.
<a name="line81"></a> */
<a name="line82"></a>goog.ui.Tab.prototype.setTooltip = function(tooltip) {
<a name="line83"></a>  this.getRenderer().setTooltip(this.getElement(), tooltip);
<a name="line84"></a>  this.setTooltipInternal(tooltip);
<a name="line85"></a>};
<a name="line86"></a>
<a name="line87"></a>
<a name="line88"></a>/**
<a name="line89"></a> * Sets the tab tooltip text.  Considered protected; to be called only by the
<a name="line90"></a> * renderer during element decoration.
<a name="line91"></a> * @param {string} tooltip New tooltip text.
<a name="line92"></a> * @protected
<a name="line93"></a> */
<a name="line94"></a>goog.ui.Tab.prototype.setTooltipInternal = function(tooltip) {
<a name="line95"></a>  this.tooltip_ = tooltip;
<a name="line96"></a>};
<a name="line97"></a>
<a name="line98"></a>
<a name="line99"></a>// Register a decorator factory function for goog.ui.Tabs.
<a name="line100"></a>goog.ui.registry.setDecoratorByClassName(goog.ui.TabRenderer.CSS_CLASS,
<a name="line101"></a>    function() {
<a name="line102"></a>      return new goog.ui.Tab(null);
<a name="line103"></a>    });
</pre>


</body>
</html>
